package com.catt.orderdinner.service.impl;

import com.catt.orderdinner.dataobject.TbShop;
import com.catt.orderdinner.repository.TbShopRepository;
import com.catt.orderdinner.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopServiceImpl implements ShopService {

    @Autowired
    private TbShopRepository tbShopRepository;

    @Override
    public List<TbShop> findAll() {
        return tbShopRepository.findAll();
    }

    @Override
    public Page<TbShop> findAll(Pageable pageable) {
        return tbShopRepository.findAll(pageable);
    }

    @Override
    public TbShop findOneByShopId(String id) {
        return tbShopRepository.findByShopId(id);
    }

    @Override
    public void save(TbShop tshop) {
        tbShopRepository.save(tshop);
    }

    @Override
    public void del(String id) {
        tbShopRepository.deleteById(id);
    }


}
